package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.StaffOptLog;
import com.pgybook.db.entity.domain.StaffOptLogEx;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

@Repository
public interface StaffOptLogMapper {
    int countByExample(StaffOptLogEx example);

    int deleteByExample(StaffOptLogEx example);

    @Delete({
            "delete from staffoptlog",
            "where ID = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
            "insert into staffoptlog (STAFF_ID, EMPLOYEENUM, ",
            "CLIENTIP, URL, OPTCONTENT, ",
            "OPTTIME)",
            "values (#{staffId,jdbcType=INTEGER}, #{employeenum,jdbcType=VARCHAR}, ",
            "#{clientip,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{optcontent,jdbcType=VARCHAR}, ",
            "#{opttime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Long.class)
    int insert(StaffOptLog record);

    int insertSelective(StaffOptLog record);

    List<StaffOptLog> selectByExample(StaffOptLogEx example);

    @Select({
            "select",
            "ID, STAFF_ID, EMPLOYEENUM, CLIENTIP, URL, OPTCONTENT, OPTTIME",
            "from staffoptlog",
            "where ID = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    StaffOptLog selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") StaffOptLog record, @Param("example") StaffOptLogEx example);

    int updateByExample(@Param("record") StaffOptLog record, @Param("example") StaffOptLogEx example);

    int updateByPrimaryKeySelective(StaffOptLog record);

    @Update({
            "update staffoptlog",
            "set STAFF_ID = #{staffId,jdbcType=INTEGER},",
            "EMPLOYEENUM = #{employeenum,jdbcType=VARCHAR},",
            "CLIENTIP = #{clientip,jdbcType=VARCHAR},",
            "URL = #{url,jdbcType=VARCHAR},",
            "OPTCONTENT = #{optcontent,jdbcType=VARCHAR},",
            "OPTTIME = #{opttime,jdbcType=TIMESTAMP}",
            "where ID = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(StaffOptLog record);
}
